package com.star.system.aspect;

import com.star.common.base.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 请求类型
 *
 * @author yangzj
 */
@Getter
@AllArgsConstructor
public enum Type implements BaseEnum<Integer> {

    OTHER(0, "其他"),
    LOGIN(1, "登录"),
    ;

    private final Integer code;
    private final String name;

    public static String getName(Integer code) {
        return Arrays.stream(Type.values())
                .filter(c -> c.getCode().equals(code)).findFirst()
                .map(Type::getName).orElse(null);
    }

    @Override
    public String getTypeCode() {
        return "request_type";
    }

    @Override
    public String getTypeName() {
        return "请求类型";
    }
}
